package study.transactionStudy.service;

import java.util.Properties;

/**
 * @author jiangfeng 2019/7/11 18:44
 */
public class MQUtils {

    /*private Producer<String, String> createProducer() {
        Properties props = new Properties();
        props.put("zk. connect", "192.168.0.244:2181,192.168.0.244:2182,192.168.0.244");
        props.put("serializer. class", "kafka. serializer. StringEncoder");
        props.put("metadata. broker. list", "ubuntu:9092");
        props.put("zk. connect", zkconnect);
        props.put("serializer. class", StringEncoder.class.getName());
        props.put("metadata. broker. list", brokers);
        ProducerConfig config = new ProducerConfig(props);
        Producer<String, String> producer = new Producer<>(config);
        return producer;
    }

    private ConsumerConnector createConsumer() {
        Properties properties = new Properties();
        properties.put("zookeeper.connect", zkconnect);//声明zk
        properties.put("group.id", "spread-event-group");//必须要使用别的组
        //properties.put("auto.offset.reset","smallest");//必须要加,如果要
        properties.put("zookeepen.connect", zkconnect);
        properties.put("group.id", work.getHandlerName());
        properties.put("zookeeper.session.timeout.ms", "400");
        properties.put("zookeeper.sync.time.ms", "200");
        properties.put("auto.commit.interval.ms", "1000");
        return Consumer.createJavaConsumerConnector(new ConsumerConfig(properties));
    }*/

}
